package com.cop.consultapp;

import java.util.ArrayList;

import com.cop.consultapp.activity.AnswerInsertActivity;
import com.cop.consultapp.activity.ConsultInsertActivity;
import com.cop.consultapp.activity.ConsultListActivity;
import com.kdn.consaltapp.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends Activity {

	private Button btnInsert=null;
	private Button btnSelect=null;
	private Button btnAnswer=null;
	private EditText editMsg=null;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		setView();
		
		//version 13...
		
	}
	

	private void setView(){
		//버튼 객체에 값 할당
		this.btnInsert=(Button)findViewById(R.id.btnInsert);
		this.btnSelect=(Button)findViewById(R.id.btnSelect);
		this.btnAnswer=(Button)findViewById(R.id.btnAnswer);
		//this.editMsg=(EditText)findViewById(R.id.editMsg);
		
		setBtnInsertOnClickListener();
		setBtnSelectOnClickListener();
		setBtnAnswerOnClickListener();
		
	}
	private void setBtnInsertOnClickListener(){
		this.btnInsert.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(getApplicationContext(), ConsultInsertActivity.class);
				
				
				startActivity(intent);
			}
		});
	}
	
	private void setBtnSelectOnClickListener(){
		this.btnSelect.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(getApplicationContext(), ConsultListActivity.class);
				
				//String inputMsg=editMsg.getText().toString();				
				//Bundle inputBundle=new Bundle();
				//inputBundle.putString("SHOW_MSG", inputMsg);				
				//intent.putExtras(inputBundle);
				
				startActivity(intent);
			}
		});
	}
	
	private void setBtnAnswerOnClickListener(){
		this.btnAnswer.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(getApplicationContext(), AnswerInsertActivity.class);
				
				
				startActivity(intent);
			}
		});
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		Log.d("mylog","main :: onDestroy");
	}

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		Log.d("mylog","main :: onPause");
	}

	@Override
	protected void onRestart() {
		// TODO Auto-generated method stub
		super.onRestart();
		Log.d("mylog","main :: onRestart");
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		Log.d("mylog","main :: onResume");
	}

	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		Log.d("mylog","main :: onStart");
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		Log.d("mylog","main :: onStop");
	}
	
	
	
	
}
